#include <iostream>

class Animal {
public:
    Animal(int legs) : numLegs(legs) {}

    void printLegs() const {
        std::cout << "I have " << numLegs << " legs." << std::endl;
    }

private:
    int numLegs;
};

class Mammal : public virtual Animal {
public:
    Mammal(int legs) : Animal(legs) {}
};

class Bird : public virtual Animal {
public:
    Bird(int legs) : Animal(legs) {}
};

class Bat : public Mammal, public Bird {
public:
    Bat() : Animal(666), Mammal(4), Bird(2) {}
};

int main() {
    Bat bat;
    bat.printLegs(); // 输出 "I have 2 legs."

    return 0;
}